from scrapy import cmdline
import tkinter.messagebox
import datetime
import ScrapyFrame.myScrapy.parseData as parseData


def do():
    # 每次获取数据，必须清空data.txt区域
    with open('./cache/cache.txt', 'w', encoding='utf-8') as fp:
        fp.flush()

    # 爬虫
    cmdline.execute("scrapy crawl example".split())

    # 获取即解析数据
    parseData.save()

    tkinter.messagebox.showinfo('提示', '数据获取成功:' + str(datetime.datetime.now()))
